package housing.task5.jaxb;

import housing.task1.actor.Address;

/**
 * Created by IntelliJ IDEA.
 * User: Linderhof
 * Date: 28.11.2010
 * Time: 15:13:08
 * To change this template use File | Settings | File Templates.
 */
public class MainJAXB {
    final static String DEFAULT_RENTERS_PATH =
            "./timoshenko_housing/src/main/resources/xml/ser/rentersJAXB.xml";
    final static String DEFAULT_ADDRESSES_PATH =
            "./timoshenko_housing/src/main/resources/xml/ser/addressesJAXB.xml";
    final static int N = 10;

    public static void main(String[] args) {
        ObjectFactory factory = new ObjectFactory();
        //Testing Addresses serialization
        Addresses addresses = factory.createAddresses();
        for (int i = 0; i < N; i++) {
            Address addr = factory.createAddress();
            addresses.getAddress().add(addr);
        }
        Serializer.serialize(addresses, DEFAULT_ADDRESSES_PATH);


        /*//Testing JAXB serialization
        Renters renters = factory.createRenters();
        for (int i = 0; i < N; i++) {
            Renter renter = factory.createRenter();
            renters.getRenter().add(renter);
        }
        Serializer.serialize(renters, DEFAULT_RENTERS_PATH);

        //Testing JAXB deserialization
        Renters deserialized = null;
        deserialized = Deserializer.deserialize(DEFAULT_RENTERS_PATH);
        System.out.println("Deserialized renters:\n");
        for (Renter r : deserialized.getRenter()) {
            System.out.println(r);
        }*/
    }//void main()

}//class MainJAXB
